#ifndef __PET_H__
#define __PET_H__
class PacketDecoder;

typedef Int32 PetId;
struct PlayerId;
class Player;
#pragma pack(1)


struct PetCSVInfo
{
	Int32			id;
	Int32			type;
	std::string		name;
	std::string		description;
	Int32			image_id;

	Int32			level;
	Int32			gender;

	Int32			require_level;
	Int32			require_gender;

	Int32			growth_max;
	Int32			growth_min;

	Int32			resistHY_max;
	Int32			resistHY_min;
	Int32			resistZS_max;
	Int32			resistZS_min;
	Int32			resistFD_max;
	Int32			resistFD_min;
	Int32			resistGH_max;
	Int32			resistGH_min;
	Int32			resistJD_max;
	Int32			resistJD_min;

	Int32			skill_0;
	Int32			has_skill_odds_0;
	Int32			skill_1;
	Int32			has_skill_odds_1;
	Int32			skill_2;
	Int32			has_skill_odds_2;
	Int32			skill_3;
	Int32			has_skill_odds_3;

	PetCSVInfo()
	{
		id = 0;
		type = 0;
		name = "";
		description = "";
		image_id = 0;
		level = 0;
		gender = 0;

		require_level = 0;
		require_gender = 0;
		growth_max = 0;
		growth_min = 0;
		resistHY_max = 0;
		resistHY_min = 0;
		resistZS_max = 0;
		resistZS_min = 0;
		resistFD_max = 0;
		resistFD_min = 0;
		resistGH_max = 0;
		resistGH_min = 0;
		resistJD_max = 0;
		resistJD_min = 0;

		skill_0 = 0;
		has_skill_odds_0 = 0;
		skill_1 = 0;
		has_skill_odds_1 = 0;
		skill_2 = 0;
		has_skill_odds_2 = 0;
		skill_3 = 0;
		has_skill_odds_3 = 0;
	}
};

class Pet
{
private:
	Pet();
public:
	Pet(PetId nPetId);
	virtual ~Pet();
	void SetPetId(PetId nPetId){m_nPetId = nPetId;}
	PetId GetPetId(){ return m_nPetId;}
	void SetPetInfo(PetInfo& info){m_stPetInfo = info;};
	PetInfo& GetPetInfo(){return m_stPetInfo;}

	void SetPetCSVInfo(PetCSVInfo* pCSVInfo){m_pPetCSVInfo = pCSVInfo;};
	PetCSVInfo* GetPetCSVInfo(){return m_pPetCSVInfo;}

	void addSkill(Int32 csv_id);
	void removeSkill(Int32 csv_id);
	bool hasSkill(Int32 csv_id);
	Skill* getSkill(Int32 csv_id);
	void decodeSkills();
	void encodeSkills();
	void sendSkills(PacketEncoder &encoder);

	void SetWatch(bool bWatch){m_bWatch = bWatch;}
	bool GetWatch(){ return m_bWatch;}

	void addEXP(Int32 nValue);
	void updateMaxValue();

	void SetOwnerPlayer(Player* pPlayer);
	Player* GetOwnerPlayer();
private:
	PetId			m_nPetId;
	PetInfo			m_stPetInfo;
	PetCSVInfo*		m_pPetCSVInfo;
	std::vector<SkillId>	m_arSkills;
	bool			m_bWatch;
	void*			m_pOwnerPlayer;
public:
	Int32 m_nNextPointHP;
	Int32 m_nNextPointMoneyHP;
	Int32 m_nNextPointAP;
	Int32 m_nNextPointMoneyAP;
	Int32 m_nNextPointDP;
	Int32 m_nNextPointMoneyDP;
	Int32 m_nNextPointSP;
	Int32 m_nNextPointMoneySP;
};
#pragma pack()
#endif